package com.gaotu.demo.jvm;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * java -Xss128K
 */
@RequestMapping("stack")
@RestController
public class StackController {

    @RequestMapping("oom/{loop}")
    public String oom(@PathVariable("loop") int loop){
        loop(loop);
        return "SUCCESS";
    }

    private void loop(int count){
        if (count < 0){
            return;
        }else {
            loop(--count);
        }
    }
}
